package com.hujing.springsource.a13;

import java.lang.reflect.Method;

/**
 * jdk的代理类
 */
public class $Proxy0 implements A13.Foo, A13.Bar {
    private A13.InvocationHandler handler;
    
    public $Proxy0(A13.InvocationHandler handler){
        this.handler = handler;
    }
    
    @Override
    public Object foo() {
        // 获取调用的方法
        try {
            Method foo = A13.Foo.class.getMethod("foo");
            return handler.invoke(foo,new Object[0]);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Object bar() {
        try {
            Method bar = A13.Bar.class.getMethod("bar");
            return handler.invoke(bar,new Object[0]);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
}
